<?php

class SignupForm extends Core_Form
{
    public function __construct($options = null) 
    { 
        parent::__construct($options);
        
        $firstName = $this->createElement('text', 'first_name')
        				  ->setLabel("First Name")
        				  ->setRequired(true)
	                      ->addValidator('NotEmpty')
	                      ->addErrorMessage('Invalid first name'); 
                      
        $lastName = $this->createElement('text', 'last_name')
        				 ->setLabel("Last Name")
        				 ->setRequired(true)
	                     ->addValidator('NotEmpty')
	                     ->addErrorMessage('Invalid last name');

        $email = $this->createElement('text', 'email')
        			  ->setLabel("Email")
        			  ->setRequired(true)
                      ->addValidator('EmailAddress')
                      ->addErrorMessage('Invalid Email id');

        $password = $this->createElement('password', 'password')
        				 ->setLabel("Password")
        				 ->setRequired(true)
                         ->addValidator('stringLength', false, array(6, 8));
                      
      	$confirmPassword = $this->createElement('password', 'confirm_password')
      							->setLabel("Confirm Password")
        						->setRequired(true)
			                    ->addValidator('stringLength', false, array(6, 12));
                      
        $captcha = $this->createElement('captcha', 'captcha',
        								array('label' => '',
        									  'captcha' => array('captcha'       => 'Image',
        												         'wordLen'       => 6,
        												         'font'          => App::getPath('captcha').'/SlabTallX.ttf',
        													     'fontsize'      => 30,
        													     'dotNoiseLevel' => 1,
        													     'imgDir'        => App::getPath('captcha').'/tmp',
        													     'imgUrl'        => '/captcha/tmp/',
        													  )
        									  )
        							  );
        							  
   		//$captcha->setAttrib('class','txtBoxBorderSmall');
        //Terms and Conditions check box
        $tnc = $this->createElement('checkbox', 'tnc')
        			->setRequired(true)
            		->addValidators(array(array('NotEmpty',true,array('message'=>array('isEmpty'=>'You must aggree for the terms and conditions')))));
                      
		$submit = $this->createElement("submit", "submit")->removeDecorator('Label');
        
        $this->addElements(array( $email,
        						 $password,  $confirmPassword, $captcha
                                 ));
                      
        /*$this->addDisplayGroup(array('first_name', 'last_name'), "test", array(
                'legend' => 'Your Account'
            ));
        $this->addDisplayGroup(array('email', 'confirm_email'), "emails");
        $this->addDisplayGroup(array('password', 'confirm_password'), "passwords");*/
        $this->addElements(array(  $submit));
    }
}
?>